# encoding: utf-8
# @File  : gen_test.py
# @Author: Ac
# @Date  : 2024/12/01/18:44
# @Note  : yield


def my_gen():
    yield 1
    yield 2
    yield 3
    return 4


# print(my_gen())

def my_fun():
    return 4


# for data in my_gen():
#     print(data)

# 可以停止的函数
# 每next一下执行一次，
mygen = my_gen()
print(next(mygen))
print(next(mygen))
print(next(mygen))
print(next(mygen))  # StopIteration: 4

# print(my_fun())
